package se.jagvetintedu;

public class Problem15 {
	
	public Long solve(Integer dim) {
		// Solution found on: http://blog.functionalfun.net/2008/07/project-euler-problem-15-city-grids-and.html
		Long start = 1L;
		
		for (int x = 1; x <= dim; x++) {
			start = start*(dim*2 + 1 - x)/x;
//			System.out.println(start + " ");
		}

		return start;
	}
	
	public static void main(String args[])
	{
		System.out.println("Project Euler, problem 15");
		
		Problem15 solution = new Problem15();

		System.out.println("number of ways through a 20x20 grid are: " + solution.solve(20));
	}
}
